package com.hr.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value = "RestController返回数据统一格式")
public class Result {
    @ApiModelProperty(value = "状态码")
    private int code=0;
    @ApiModelProperty(value = "提示消息")
    private String msg="";
    @ApiModelProperty(value = "返回数据")
    private Object data;

    public static Result ok(){
        return new Result();
    }

    public static Result ok(Object data){
        return new Result(data);
    }

    public Result() {
    }

    public Result(Object data) {
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Result{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
